home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
newmarch.zip
/
INFO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-08
|
2KB
|
87 lines
/* Author: $Author: jan $
* File: $Source: /usr/usrs/jan/desktop/X_Book.boo/programs/RCS/info.c,v $
* Date: $Date: 1992/09/09 00:10:03 $
* Revision: $Revision: 1.1 $
*/
#include "copyright.h"
/*
** File: info.c
** Purpose: give general information about the server
*/
/*
** Needed for NULL pointer, as well as
** any IO to an xterm window
*/
#include <stdio.h>
/*
** General X include files
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
/*
** Global variables
*/
Display *display; /* the display device */
int screen; /* the screen on the display */
/*
** Connect to the server and get the display
** device and the screen number
*/
void
initX ()
{
/* set the display name from
the environment vbl DISPLAY */
display = XOpenDisplay (NULL);
if (display == NULL)
{ fprintf (stderr,
"Unable to open display %s\n",
XDisplayName (NULL));
exit (1);
}
screen = DefaultScreen (display);
}
/*
** Give general info about the server
** characteristics
*/
void
report_info ()
{
printf ("There are %d color planes\n",
DefaultDepth (display, screen));
printf ("The display width in pixels is %d\n",
DisplayWidth (display, screen));
printf ("The display depth in pixels is %d\n",
DisplayHeight (display, screen));
printf ("The display name is %s\n",
XDisplayName (display));
}
/*
** Terminate the program gracefully
*/
void
quitX ()
{
XCloseDisplay (display);
exit (0);
}
int
main (argc, argv)
int argc;
char **argv;
{
initX ();
report_info ();
quitX ();
}